<template>
    <a  @click="download" sysFileObj="sysFile">{{downloadMsg}}</a>
</template>

<script>
import {downloadSysFile} from '@/api/system'

    export default {
        name: "KSysFileDownload",
        props:{
            sysFileObj:{
                type:Object,
                required:true
            },
            downloadMsg:{
                type: String,
                required: true
            }
        },
        model: {
            prop: 'sysFileObj',
            event: 'click'
        },
        watch: {
            sysFileObj: {
                immediate: true,
                handler(curVal, oldVal) {
                    this.sysFile = curVal;
                },
            },
            downloadMsg:{
                immediate: true,
                handler(curVal, oldVal) {
                    this.downloadMsg = curVal;
                },
            }


        },
        data(){
            return {
                sysFile:{},
            }
        },
        methods:{
            download(){
                let param={};
                param.fileId=this.sysFile.fileId;
                downloadSysFile(this.sysFile.fileName,param).then(res=>{
                    console.log(res)
                })
            },
        }
    }
</script>
